var Category = function(color, status, name, id) {
	this.color = color;
	this.name = name;
	this.status = status;
	this.id = id
};


Category.prototype.changeStatus = function() {
  if (this.status == 'inactive') {
    $($( "#category-list > li" ).get(this.id-1)).removeClass('inactive').addClass('active');
	this.status = 'active';
  } else {
   $($( "#category-list > li" ).get(this.id-1)).removeClass('active').addClass('inactive');
	this.status = 'inactive';
  }
}
	
/***************************************************************
Gets places from database
****************************************************************/

Category.prototype.getPlacesFromDb = function() {

	var id = (this.id);
	var pointsLat = [];
	var pointsLng = [];
	if (desiredSteps.length != 0) {
		for(var i=0; i < desiredSteps.length; i++) { //takes out lat and lng from desiredSteps
		var stepsLat = desiredSteps[i].lat();
		var stepsLng = desiredSteps[i].lng();
		pointsLat.push(stepsLat);
		pointsLng.push(stepsLng);
		}
		$.post('../includes/functions.php', { action: 'get_toppstopps', categoryId: id, radius: radius, lat: pointsLat, lng: pointsLng}, function(data){
		 
			//var location = new google.maps.LatLng(desiredSteps[i].lat(),desiredSteps[i].lng());
		},'json');
	}	
}
	
  Category.prototype.getPlacesFromGgl = function() {
	
	//converting category name from string to array
	var types = [];
	types.push(this.name);

	var that = this;
	
	 console.debug('Here is where getPlace starts');
	if (desiredSteps.length != 0) {
		console.debug('There is desiredSteps');
		console.debug('There are ' + desiredSteps.length + 'desired steps.');
		console.debug('we are looking for ' + this.name);
		console.debug('radius is: ' + radius)
		for(var i=0; i < desiredSteps.length; i++) {
		
			console.debug(desiredSteps[i]);
			var request = {
			location : desiredSteps[i],
			radius   : radius,
			types     : types 
			};

			var placeService = new google.maps.places.PlacesService(map);
			placeService.search(request, function(resultArray, status){
			console.debug(status);
			if (status == 'OK'){
				for(var j=0; j<resultArray.length; j++) {
					 places.push(resultArray[j]);
					 attachMarker(resultArray[j],that.name);						
				}
			}

		 });

		} 
    }
}

